Various data processing systems have been developed including storage systems, cellular telephone systems, and radio transmission systems. In such systems data is transferred from a sender to a receiver via some medium. For example, in a storage system, data is sent from a sender (i.e., a write function) to a receiver (i.e., a read function) via a storage medium. As information is stored and transmitted in the form of digital data, errors are introduced that, if not corrected, can corrupt the data and render the information unusable. The effectiveness of any transfer is impacted by any losses in data caused by various factors. Data may be encoded to constrain patterns in the data, preventing or replacing error-prone data patterns. Data may also be encoded to enable error correction, for example adding parity bits to the data that allow errors to be detected and corrected downstream. However, parity bits added after constraint encoding are not protected by the constraint encoding and can therefore be more likely to have errors.